<template>
  <div>
    <el-radio-group v-model="tabPosition" style="margin-bottom: 20px;">
      <el-radio-button label="overview">总览</el-radio-button>
      <!--<el-radio-button label="detail">详细</el-radio-button>-->
    </el-radio-group>
    <div v-show="tabPosition==='overview'">
      <el-table :data="overviewData" style="width: 100%;" height="500" :header-cell-style="headerCellStyle">
        <el-table-column prop="id" align="center" label="序号" width="150">
        </el-table-column>
        <el-table-column prop="number" align="center" label="商品编号" width="250">
        </el-table-column>
        <el-table-column prop="productName" align="center" label="商品名称" width="250">
        </el-table-column>
        <el-table-column prop="price" align="center" label="商品价格" width="250">
        </el-table-column>
        <el-table-column prop="inventory" align="center" label="可售库存" width="250">
        </el-table-column>
        <el-table-column prop="sold" align="center" label="直播已售" min-width="200">
        </el-table-column>
      </el-table>
      <div class="toolbar" style="padding:10px;">
        <el-pagination
          @size-change="sizeChangeHandle"
          @current-change="currentChangeHandle"
          :current-page="pageIndex"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="pageSize"
          :total="totalPage"
          layout="total, sizes, prev, pager, next, jumper">
        </el-pagination>
      </div>
    </div>
    <div v-show="tabPosition==='detail'">
      <el-form label-width="120px"  size="mini" :model="dataForm">
        <el-row>
          <el-col :span="7">
            <el-form-item label="订单号：">
              <el-input v-model="dataForm.orderNo" ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item label="会员账户：">
              <el-input v-model="dataForm.account" ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item label="提交时间：">
              <el-date-picker
                style="width: 100%"
                v-model="dataForm.time"
                value-format="yyyy-MM-dd HH:mm:ss"
                :default-time="['00:00:00', '23:59:59']"
                type="datetimerange"
                range-separator="至"
                start-placeholder="开始日期"
                end-placeholder="结束日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :offset="3"></el-col>
          <el-col :span="7">
            <el-form-item label="商品编码：">
              <el-input v-model="dataForm.number" ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item>
              <el-button>查询</el-button>
              <el-button type="primary" @click="reset()">重置</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <el-table :data="detailData" style="width: 100%" height="500" :header-cell-style="headerCellStyle">
        <el-table-column prop="id" label="序号" width="150">
        </el-table-column>
        <el-table-column prop="orderNo" align="center" label="订单号" width="250">
        </el-table-column>
        <el-table-column prop="name" align="center" label="商家名称" width="250">
        </el-table-column>
        <el-table-column prop="time" align="center" label="提交时间" width="250">
        </el-table-column>
        <el-table-column prop="account" align="center" label="会员账户" width="250">
        </el-table-column>
        <el-table-column prop="price" align="center" label="订单金额" width="150">
        </el-table-column>
        <el-table-column label="操作" align="center" min-width="150">
          <template slot-scope="scope">
            <el-button size="mini" type="text">查看订单</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>
<script>
  export default {
    name: "LiveInfoDataShop",
    components: {
    },
    data() {
      return {
        headerCellStyle:{
          'background-color': '#f1f1f1'
        },
        liveId:'',
        dataList:[],
        pageIndex: 1,
        pageSize: 10,
        totalPage: 0,
        tabPosition:'overview',
        overviewData:[],
        detailData:[],
        dataForm:{}
      }
    },
    mounted: function () {

    },
    methods: {
      getPData(row){
        this.liveId=row.id;
        this.getDataList()
      },
      reset(){
        this.dataForm = {}
      },
      // 获取数据列表
      getDataList() {
        let params={};
        params.pageNum=this.pageIndex;
        params.pageSize=this.pageSize;
        params.liveId=this.liveId;
        this.utils.request.liveRequest({
          url: '/api/v1/liveData/getLiveProductInfo',
          method:'get',
          params: params
        }).then(result => {
          let data = result.data;
          if (data && data.code == "0") {
            this.overviewData=data.data.rows;
            this.totalPage = data.data.total
          }
        })
      },
      // 每页数
      sizeChangeHandle(val) {
        this.pageSize = val
        this.pageIndex = 1
        this.getDataList()
      },
      // 当前页
      currentChangeHandle(val) {
        this.pageIndex = val
        this.getDataList()
      },
    }
  }
</script>
<style scoped lang="scss">

</style>
